package com.sh4.dao.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sh4.dao.PermissionResourceDao;
import com.sh4.entity.PremissionResources;

@Repository
public class PermissionResourceDaoImpl extends BaseDaoImpl<PremissionResources> implements PermissionResourceDao{

	@Override
	public List<String> getPermissionResources(String permissionId) {
		
		String sql = "SELECT u.ID_ as id FROM premission_resources pr INNER JOIN menu u ON(u.ID_ = pr.RESOURCE_ID_ and u.URL_ is not null) where pr.PERMISSION_ID_ = ?";
		List<Map<String, Object>> ps = this.getArrayBySql(sql, permissionId);
		List<String> resList = new ArrayList<String>();
		for(Map<String, Object> p : ps) {
			resList.add(p.get("id").toString());
		}
		return resList;
	}


}
